#define  _IPC_EXCHANGE_GLOBAL_
#include "config.h"

void ipcExchangeEvent(ULONG enumWhatEvent,ULONG lPara,BYTE *p,ULONG length)
{
    if (enumWhatEvent > EVENT_GLOBAL_VIDEO_MIN && enumWhatEvent < EVENT_GLOBAL_VIDEO_MAX)
	{
		ipcEventProcVideo (enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_NAVI_BOARD_MIN && enumWhatEvent < EVENT_GLOBAL_NAVI_BOARD_MAX)
	{
		ipcEventProcNaviBoard(enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_KEY_EXEC_MIN && enumWhatEvent < EVENT_GLOBAL_KEY_EXEC_MAX)
	{
		ipcEventProcKeyExec(enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_ACC_MIN && enumWhatEvent < EVENT_GLOBAL_ACC_MAX)
	{
		ipcEventProcACC(enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_KEY_MIN && enumWhatEvent < EVENT_GLOBAL_KEY_MAX)
	{
		ipcEventProcKey(enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_DASHBOARD_INFO_MIN && enumWhatEvent < EVENT_GLOBAL_DASHBOARD_INFO_MAX)
	{
		ipcEventProcDashBoard(enumWhatEvent,lPara,p,length);
	}
	else if (enumWhatEvent > EVENT_GLOBAL_AUTO_CLR_MIN && enumWhatEvent < EVENT_GLOBAL_AUTO_CLR_MAX)
	{
		ipcEventProcNaviBoard(enumWhatEvent,lPara,p,length);
		ipcEventProcKeyExec(enumWhatEvent,lPara,p,length);
		ipcEventProcKey(enumWhatEvent,lPara,p,length);
		ipcEventProcACC(enumWhatEvent,lPara,p,length);
		ipcClearEvent(enumWhatEvent);
	}
	else
	{
	}
}

void ipcStartEvent(ULONG enumWhatEvent,ULONG lPara,BYTE *p,ULONG length)
{
	sbi(ipcInfo.EventSet[enumWhatEvent/32], enumWhatEvent%32);

	ipcExchangeEvent(enumWhatEvent,lPara,p,length);
}

void ipcClearEvent(UINT32 sourceEvent)
{
	cbi(ipcInfo.EventSet[sourceEvent/32], sourceEvent%32);
}

BOOL ipcWhatEventOn(UINT32 sourceEvent)
{
	return bit_is_set(ipcInfo.EventSet[sourceEvent/32], sourceEvent%32);
}

void ipcInit(void)
{
	memset(&ipcInfo,0,sizeof(IPC_INFO));
}
